package file;

import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: Administrator
 * \* Date: 2022/4/8
 * \* Time: 19:31
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */
public class Demo10 {
    public static void main(String[] args) {
        try (Reader reader = new FileReader("d:/a.txt")){
            //按照字符来读
            while(true){
                char[] buffer = new char[1024];
                int len = reader.read(buffer);
                if(len == -1){
                    break;
                }
                for (int i = 0; i < len; i++) {
                    System.out.println(i);
                }
            }
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
